<%@LANGUAGE="VBSCRIPT" CODEPAGE="1251"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Untitled Document</title>
</head>
<!--#include file="../../../Connect/Connection.asp"-->
<!--#include file="../../../Connect/adovbs.inc"-->
<%
	Set cnn=Server.CreateObject("ADODB.Connection")
	cnn.open connStr&";Initial Catalog=sms_d"	
	Set cmd=Server.CreateObject("ADODB.Command")

	sContent=Left(Request.Form("txtContent"),1024)
	sTerminals=Left(Request.Form("txtTerminals"),7000)
	sFiles=Left(Request.Form("txtFiles"),1024)
	sCont=replace(Request.Form("chkCont"),",",";") & ";"
	
	IF Request.QueryString("action")="change" THEN
		NameProcedure="sp_Application_change"	
		sParam=adParamInput
	ELSE
		NameProcedure="sp_Application_add"	
		sParam=adParamOutput
	END IF
	
	With cmd
		.ActiveConnection = cnn
		.CommandType = adCmdStoredProc
		.Commandtext = NameProcedure
		.Parameters.Append .CreateParameter("@Descrip", adVarChar, adParamInput,50)
		.Parameters.Append .CreateParameter("@Content", adVarChar, adParamInput,1024)
		.Parameters.Append .CreateParameter("@Terminals", adVarChar, adParamInput,7000)
		.Parameters.Append .CreateParameter("@Files", adVarChar, adParamInput,1024)
		.Parameters.Append .CreateParameter("@LogName", adVarChar, adParamInput,50)
		.Parameters.Append .CreateParameter("@Date", adDate, adParamInput)
		.Parameters.Append .CreateParameter("@OtvPersons", adVarChar, adParamInput,1024)
		.Parameters.Append .CreateParameter("@NumApp", adInteger, sParam)
		.Parameters.Append .CreateParameter("@Ans", adVarChar, adParamOutput,200)
		.Parameters("@Descrip")=Request.Form("txtDescription")
		.Parameters("@Content")=sContent
		.Parameters("@Terminals")=sTerminals
		.Parameters("@Files")=sFiles
		.Parameters("@LogName")=Request.Form("txtPerson")
		.Parameters("@Date")=Request.Form("txtDate")
		IF Request.QueryString("action")="change" THEN
			.Parameters("@NumApp")=Request.Form("txtNum")
		END IF
		.Parameters("@OtvPersons")=sCont
		.Execute
	End with

	IF Request.QueryString("action")="change" THEN
		NumApp=Request.Form("txtNum")
	ELSE
		NumApp=cmd.Parameters("@NumApp")
	END IF
			
	
	Answer=cmd.Parameters("@Ans")
	
	set cmd=nothing
	cnn.close
	Set cnn=nothing
	
	Response.Redirect "ApplicationWrite.asp?NumApp=" & NumApp
%>

<body>

</body>
</html>
